using System;
using System.Collections;

namespace VCDepend.Engine
{
	public class StringArrayMaker
	{
		public delegate string Converter(object o);

		private StringArrayMaker()
		{
		}

		public static string[] ToArray(ICollection collection)
		{
			string[] result = new string[collection.Count];
			collection.CopyTo(result, 0);

			return result;
		}

		public static string[] ToArray(ICollection collection, Converter converter)
		{
			string[] result = new string[collection.Count];
			
			int i = 0;
			foreach (object o in collection)
			{
				result[i++] = converter(o);
			}

			return result;
		}
	}
}
